package com.mrd.gtimpframe.service;

import com.mrd.gtimpframe.entity.Dictionary;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;

public interface DictionaryService {
    int deleteByPrimaryKey(String id);

    int insert(Dictionary record);

    int insertSelective(Dictionary record);

    Dictionary selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(Dictionary record);

    int updateByPrimaryKey(Dictionary record);

    /**
     * 根据字典组ID查询有效的字典信息
     *
     * @param groupId 字典组ID
     * @return List<Dictionary>
     */
    List<Dictionary> selectByGroupId(String groupId, boolean justValid);

    Page<Map<String, Object>> listPageData(Pageable page, Map<String, Object> params);

    /**
     * 逻辑删除
     *
     * @param id 主键ID
     */
    int updateDeleteStateByPrimaryKey(String id);

    /**
     * 通过字典组Code获取字典
     * 先将code转为id，再从redis中获取字典
     *
     * @param codes 字典组Code 支持多个code
     */
    List<Dictionary> selectWithDictionaryByCodesIn(String... codes);

    /**
     * 通过字典组ID获取字典
     *
     * @param ids 字典组id 支持多个id
     */
    List<Dictionary> selectWithDictionaryByPrimaryKey(String... ids);

    /**
     * 支持获取多个字典
     */
    List<Dictionary> selectByPrimaryKeyArray(String... ids);
}
